import React, { Component } from 'react'
import pubsub from 'pubsub-js'
export default class B extends Component {
  render() {
    return (
        <div style={{width:'200px',height:'200px',backgroundColor:'springgreen'}}>
          <button onClick={()=>{
            /**
             * pubsub.dispatch(参数1，参数2)
             * 参数1：事件名:相当于频道
             * 参数2：发送的信息
             */
            pubsub.publish("send",'Hello Giles')
          }}>发送信息</button>
        </div>
    )
  }
}
